package com.controller;

import com.service.IMenuService;
import com.until.Result;
import com.vo.TreeNode;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RestController
@RequestMapping("menu")
public class MenuController extends BaseController{
    @Resource
    private IMenuService menuService;

    @GetMapping("listTreeNodeData")
    public Result listTreeNodeData(){

        return success(menuService.listTreeNodeData());
    }

    @GetMapping("listTreeNodeByEmpId")
    public Result listTreeNodeByEmpId() {

        return success(menuService.listTreeNodeByEmpId());
    }

    @PostMapping("insert")
    public Result insert(@RequestBody TreeNode treeNode){
        return success(menuService.insert(treeNode));
    }

    @PostMapping("update")
    public Result update(@RequestBody TreeNode treeNode){
        return success(menuService.update(treeNode));
    }

    @DeleteMapping("delete")
    public Result delete(Integer menuId){
        return success(menuService.delete(menuId));
    }
}
